Passed
Push — master ( 0543ef...cf6673 )
by Miloš
02:59
created

AnonymousAuth.handleNativeLogin   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
1
import { Injectable } from "@angular/core";
2
import { AngularFireAuth } from "@angular/fire/auth";
3
import { Platform } from "@ionic/angular";
4
import { auth } from "firebase/app";
5
import { AbstractAuth } from "../../providers/abstract-auth";
6
import { IAuthProvider } from "../../providers/i-auth-provider";
7
8
@Injectable({
9
    providedIn: "root",
10
})
11
export class AnonymousAuth extends AbstractAuth implements IAuthProvider {
12
    public readonly providerOptions = {};
13
14
    public constructor(angularFireAuth: AngularFireAuth, platform: Platform) {
15
        super(angularFireAuth, platform);
16
    }
17
18
    public async handleNativeLogin(options: any): Promise<auth.UserCredential> {
19
        return this.handleBrowserLogin();
20
    }
21
22
    public async handleBrowserLogin(): Promise<auth.UserCredential> {
23
        return await auth().signInAnonymously();
24
    }
25
26
    protected getBrowserLoginProvider(): null {
27
        return null;
28
    }
29
}
30